import { type AxiosPromise } from "axios";
import { post, get } from "@/utils/request";

export const login = (param: {
  username: string;
  password: string;
}): AxiosPromise => {
  return post("/login", param);
};
export const logout = (): AxiosPromise => {
  return post("/logout", {});
};

export const adminInfo = (): AxiosPromise => {
  return get("/account/info", {});
};

export interface AdminUpdateData {
  [key: string]: unknown;
}

export const adminUpdate = (data: AdminUpdateData): AxiosPromise => {
  return post("/account/update", data);
};
export interface AdminPasswordData {
  [key: string]: unknown;
}

export const adminPassword = (data: AdminPasswordData): AxiosPromise => {
  return post("/account/password", data);
};
